package com.itheima.d6_object_stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Arrays;

/*
  目标：掌握对象字节输入流的使用：反序列化对象。
 */
public class Test2ObjectInputStream {
    public static void main(String[] args) throws Exception {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));

         ArrayList<User> list = (ArrayList<User>) ois.readObject();
        System.out.println(list);
        for (User user : list) {
            System.out.println(user);
        }
        ois.close();
    }

}
